package com.xugou.service.Impl;

import com.xugou.dao.EmpDao;
import com.xugou.pojo.Emp;
import com.xugou.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class EmpServiceImpl implements EmpService {

    @Autowired
    @Qualifier("empDao")
    private EmpDao empDao;

    public void setEmpDao(EmpDao empDao) {
        this.empDao = empDao;
    }

    public boolean deleteEmpInfo(int empId) {
        int i = empDao.deleteEmpInfo(empId);
        if (i!=1){
            return false;
        }
        return true;
    }

    public boolean updateEmp(Emp emp) {
        int i = empDao.updateEmp(emp);
        if (i!=1){
            return false;
        }
        return true;
    }

    public Emp queryEmpId(int empId) {
        Emp emp = empDao.queryEmpId(empId);
        if (emp==null){
            return null;
        }
        return emp;
    }

    public boolean addEmp(Emp emp){
        boolean b = empDao.addEmp(emp);
        if(b){
            return true;
        }else {
            return false;
        }
    }
}
